﻿using Data.Migrations;
using Data.MyDbContext;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using WebIndex1.App_Start;

namespace WebIndex1
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            //autofac register
            AutofacConfig autofacContainer = new AutofacConfig();
            autofacContainer.Configure();


            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);


            //Database.SetInitializer<WebStudioDbContext>(new DropCreateDatabaseAlways<WebStudioDbContext>());
            Database.SetInitializer<WebStudioDbContext>(new MigrateDatabaseToLatestVersion<WebStudioDbContext, Configuration>());
            //Database.SetInitializer(new Initializer()); 

            //Database.SetInitializer(new Data.MyDbContext.ContextInitializer.EntitiesContextInitializer());
        }
    }
}
